feat(framework): post-merge queues the quality follow-ups (#556)#558
Merged
Conversation
On setReadyForMerge(), a --post-merge run fired maintainability, readability and security-audit as three child runs on the spot. It now fires one turn that appends the follow-ups to the session TODO file, for the backlog loop to pick up, which is what the #326 doc says. The post-merge prompt is flattened rather than verbatim: the doc nests a fragment inside a fragment, which the non-greedy fragment regex cannot parse. Same branch, same output, one fragment.
This was referenced Jul 15, 2026
suleimansh
added a commit
that referenced
this pull request
Jul 16, 2026
The backlog loop prompts through the run's own driver session, so a backlog turn carries the same signal protocol as any other turn. promptItem only parsed await gates, so everything else was dropped: showMarkdown() views never reached the rail, setSessionName() was ignored, and setReadyForMerge() never emitted ready-for-merge, which is what maybeFirePostMerge gates on. So --post-merge could not fire from backlog work, now that the queue is where post-merge writes its follow-ups (#558) and the knowledge docs (#537). The cause was duplication: emitTurnSignals was byte-identical in run.ts and prompt-run.ts, and the third turn site never got a copy. It is now one createTurnSignalEmitter used by all three. The backlog loop keeps a single emitter for the whole backlog, so ready-for-merge still fires once. Closes #563
suleimansh
added a commit
that referenced
this pull request
Jul 16, 2026
…597) * refactor(framework): preset prompts use ${{ tf.params.what }}, retire <PARAM:name> (#594) Rom's updated #326 OP and the preset OPs switched the preset blank from <PARAM:what> to ${{ tf.params.what }}, the same fragment syntax the system prompt uses. Move the presets onto renderTemplate and delete the bespoke preset-params.ts primitive, which is then fully unused. render<Name>Prompt(what) is unchanged: byte-identical output for all 5 presets, default and custom, proven with a before/after render probe. Prereq for #326's post-merge preset filePath entries. Closes #594 * feat(framework): post-merge entries carry the preset filePath (#596) Rom's updated #326 OP block 2 changed the post-merge TODO entries from a bare preset name the agent had to guess to a real file it opens: Apply .the-framework/presets/maintainability.md with tf.params.what set to "changes introduced by <session>" - new presets.ts: PRESETS registry (keyed by file stem, matching Rom's tf.presets.security_audit key), presetFilePath, presetContext, materializePresets - installProject materializes the 5 presets into .the-framework/presets/*.md so filePath resolves; gitignored, so they track the framework version - post-merge ## Maintenance re-flattened to Rom's OP block 2; drift snapshot updated (turns the drift check green) - tf.presets.<name>.filePath plumbed through PostMergeContext, defaulted from presetContext() Closes the fidelity gap #558 introduced. Proven end to end: install materializes the files, and the rendered entry's filePath points at one that exists on disk. Closes #596
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #556
Follow-up to #557, which synced the first ```md block of #326. This is the second block.
Draft on purpose: it needs a yes on the flattening below before it should land. Everything else is green.
On
setReadyForMerge(), a--post-mergerun used to fire maintainability, readability and security-audit as three childframework promptruns, back to back, on the spot. It now fires one short turn that appends"Apply preset X on the changes introduced by <session>"to the session TODO file and lets the backlog loop (#323/#538) pick them up. That is what the doc says, and it is much cheaper: a few TODO lines instead of three full preset passes serialized on the same git index.What it sends now, rendered from the real template:
The readability entry only appears under Technical control, per the doc. That setting already existed as a preference, a
--technicalflag and a Global options toggle, it just never reached the prompts, soTfContextgainssettings.technical_controlandsession_name. The session name is carried on run state: set before the first change, read after the run.--eco-auto-maintenancedoes something again. #326 moved the maintenance section out of the system prompt, which left the flag inert (#555). The post-merge prompt is exactly that section, so the flag now skips it.The one thing that needs a call
The post-merge block cannot be synced verbatim. It nests
${{ tf.session_name }}inside the outer${{ ... }}and puts backticks inside a backtick template literal.FRAGMENTis non-greedy, so the outer fragment closes on the inner}}and the rest is not valid JS. It throws today, with or without the new context fields:So it is flattened to one fragment, same logic, same output:
That is prompt text, so it wants a review round before it lands rather than after. A test now rejects any nested fragment, so the prompt cannot regress into a shape that does not render.
POST_MERGE_PASSES/runPostMergeSuiteare replaced byrunPostMerge/renderPostMergePrompt. The three preset modules are untouched, the dashboard buttons still use them. 530 pass, 0 fail, typecheck green across all 21 packages.